package com.yuanss.smart.fdemo.controller;

import com.yuanss.smart.fdemo.mode.Customer;
import com.yuanss.smart.fdemo.service.CustomerService;
import com.yuanss.smart.framework.annotation.Action;
import com.yuanss.smart.framework.annotation.Controller;
import com.yuanss.smart.framework.annotation.Inject;
import com.yuanss.smart.framework.bean.Data;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;

/**
 * @Description 客户控制器
 * @Date 2024/11/15 下午4:53
 * @Created by 菜到不敢run
 */
@Controller
public class CustomerController {

    @Inject
    private CustomerService customerService;

    private static final Logger LOGGER = LoggerFactory.getLogger(HelloController.class);

    // 优化前：Controller不定义Param：java.lang.IllegalArgumentException: wrong number of arguments
    @Action("get:/customer")
    public Data listCustomers() {
        List<Customer> customerList = customerService.getCustomerList();
        return new Data(customerList);
    }
}
